#!/bin/bash
#
:<<EOF

[ -f repoNfs.sh ] && (
docker cp repoNfs.sh elasticsearch:/opt/.
docker cp repoNfs.sh elasticsearch2:/opt/.

docker exec -it elasticsearch /opt/repoNfs.sh
docker exec -it elasticsearch2 /opt/repoNfs.sh
)

EOF

#https://www.myfreax.com/how-to-install-and-configure-an-nfs-server-on-centos-8/
if [ -f /usr/sbin/exportfs ]; then
 echo "nfs client installed"
else
 yum install -y nfs-utils
fi

ping -c 1 172.19.0.1
mount|grep 'nfs4' |grep 'backup' && umount /opt/backup
mount -v -t nfs -o vers=4,port=2049 172.19.0.1:/data /opt/backup

echo "done"